package com.epro.dx.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.epro.dx.activity.order.fragment.MyOrderFragment;

public class MyOrderAdapter extends FragmentPagerAdapter {
	
	//标题集合
	private String[] tabs;
	private FragmentManager fm;
	private List<MyOrderFragment> fragmentsList;

	public MyOrderAdapter(FragmentManager fm,String[] tabs, List<MyOrderFragment> fragments) {
		super(fm);
		this.fm = fm;
		this.tabs = tabs;
		this.fragmentsList=fragments;
	}

	@Override
	public Fragment getItem(int position) {
		//返回对应的Fragment
//		Fragment fragment = MyOrderFragmentFactory.getFragment(position,pageOrdersList,myNewOrdersActivity);
		return fragmentsList.get(position);
	}

	@Override
	public int getCount() {
		// 返回页面数
		return tabs.length;
	}
	
	@Override
	public CharSequence getPageTitle(int position) {
		//设置显示tab
		if(tabs!=null)
			return tabs[position];
		return super.getPageTitle(position);
	}

}
